/****************************************************************
 * Fulguro
 * Copyright (C) 2004 Christophe Clienti
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 ***************************************************************/

#include <flgrCoreData.h>
#include <flgrCoreIO.h>
#include <flgrCoreVector.h>
#include <flgrCoreCopy.h>
#include <flgrCoreShift.h>
#include <flgrCoreDispatch.h>
#include <flgrCoreArithDef.h>
#include <flgrArith.h>
#include <flgrArithShift.h>
#include "flgrMorphoBaseLog.h"

/*!
 * \addtogroup group_fulguro_core_morpho_base
 * @{
 */



/********************************************************************************************/
/********************************************************************************************/
/************************************** 1D Functions ****************************************/
/********************************************************************************************/
/********************************************************************************************/

/////////////////////////////////////////////////////////////////////////
// Macro for different types of flgr1d_internal_erode_log
/////////////////////////////////////////////////////////////////////////
#define FLGR_1D_MACRO_INTERNAL_ERODE_LOG(dtype)				\
  if(size == 1) {							\
    flgr1d_erode_2_points_##dtype(lineout,linein,tmpline,1);		\
    return;								\
  }									\
  									\
  flgr1d_erode_2_points_##dtype(lineout,linein,tmpline,size/2);		\
									\
  flgr1d_internal_erode_log_##dtype(lineout,lineout,tmpline,size/2);	\
  									\
  if((size%2) == 1)							\
    flgr1d_erode_2_points_##dtype(lineout,lineout,tmpline,1)


void flgr1d_internal_erode_log_fgBIT(FLGR_Data1D *lineout, FLGR_Data1D *linein, 
				     FLGR_Data1D *tmpline, int size) {
  FLGR_1D_MACRO_INTERNAL_ERODE_LOG(fgBIT);
}
void flgr1d_internal_erode_log_fgUINT8(FLGR_Data1D *lineout, FLGR_Data1D *linein, 
				       FLGR_Data1D *tmpline, int size) {
  FLGR_1D_MACRO_INTERNAL_ERODE_LOG(fgUINT8);
}
void flgr1d_internal_erode_log_fgUINT16(FLGR_Data1D *lineout, FLGR_Data1D *linein, 
					FLGR_Data1D *tmpline, int size) {
  FLGR_1D_MACRO_INTERNAL_ERODE_LOG(fgUINT16);
}
void flgr1d_internal_erode_log_fgUINT32(FLGR_Data1D *lineout, FLGR_Data1D *linein,
					FLGR_Data1D *tmpline, int size) {
  FLGR_1D_MACRO_INTERNAL_ERODE_LOG(fgUINT32);
}
void flgr1d_internal_erode_log_fgINT8(FLGR_Data1D *lineout, FLGR_Data1D *linein, 
				      FLGR_Data1D *tmpline, int size) {
  FLGR_1D_MACRO_INTERNAL_ERODE_LOG(fgINT8);
}
void flgr1d_internal_erode_log_fgINT16(FLGR_Data1D *lineout, FLGR_Data1D *linein, 
				       FLGR_Data1D *tmpline, int size) {
  FLGR_1D_MACRO_INTERNAL_ERODE_LOG(fgINT16);
}
void flgr1d_internal_erode_log_fgINT32(FLGR_Data1D *lineout, FLGR_Data1D *linein, 
				       FLGR_Data1D *tmpline, int size) {
  FLGR_1D_MACRO_INTERNAL_ERODE_LOG(fgINT32);
}
void flgr1d_internal_erode_log_fgFLOAT32(FLGR_Data1D *lineout, FLGR_Data1D *linein, 
					 FLGR_Data1D *tmpline, int size) {
  FLGR_1D_MACRO_INTERNAL_ERODE_LOG(fgFLOAT32);
}
void flgr1d_internal_erode_log_fgFLOAT64(FLGR_Data1D *lineout, FLGR_Data1D *linein, 
					 FLGR_Data1D *tmpline, int size) {
  FLGR_1D_MACRO_INTERNAL_ERODE_LOG(fgFLOAT64);
}







/////////////////////////////////////////////////////////////////////////
// Macro for different types of flgr1d_internal_dilate_log
/////////////////////////////////////////////////////////////////////////
#define FLGR_1D_MACRO_INTERNAL_DILATE_LOG(dtype)			\
  if(size == 1) {							\
    flgr1d_dilate_2_points_##dtype(lineout,linein,tmpline,1);		\
    return;								\
  }									\
  									\
  flgr1d_dilate_2_points_##dtype(lineout,linein,tmpline,size/2);	\
									\
  flgr1d_internal_dilate_log_##dtype(lineout,lineout,tmpline,size/2);	\
  									\
  if((size%2) == 1)							\
    flgr1d_dilate_2_points_##dtype(lineout,lineout,tmpline,1)


void flgr1d_internal_dilate_log_fgBIT(FLGR_Data1D *lineout, FLGR_Data1D *linein, 
				      FLGR_Data1D *tmpline, int size) {
  FLGR_1D_MACRO_INTERNAL_DILATE_LOG(fgBIT);
}
void flgr1d_internal_dilate_log_fgUINT8(FLGR_Data1D *lineout, FLGR_Data1D *linein, 
					FLGR_Data1D *tmpline, int size) {
  FLGR_1D_MACRO_INTERNAL_DILATE_LOG(fgUINT8);
}
void flgr1d_internal_dilate_log_fgUINT16(FLGR_Data1D *lineout, FLGR_Data1D *linein, 
					 FLGR_Data1D *tmpline, int size) {
  FLGR_1D_MACRO_INTERNAL_DILATE_LOG(fgUINT16);
}
void flgr1d_internal_dilate_log_fgUINT32(FLGR_Data1D *lineout, FLGR_Data1D *linein,
					 FLGR_Data1D *tmpline, int size) {
  FLGR_1D_MACRO_INTERNAL_DILATE_LOG(fgUINT32);
}
void flgr1d_internal_dilate_log_fgINT8(FLGR_Data1D *lineout, FLGR_Data1D *linein, 
				       FLGR_Data1D *tmpline, int size) {
  FLGR_1D_MACRO_INTERNAL_DILATE_LOG(fgINT8);
}
void flgr1d_internal_dilate_log_fgINT16(FLGR_Data1D *lineout, FLGR_Data1D *linein, 
					FLGR_Data1D *tmpline, int size) {
  FLGR_1D_MACRO_INTERNAL_DILATE_LOG(fgINT16);
}
void flgr1d_internal_dilate_log_fgINT32(FLGR_Data1D *lineout, FLGR_Data1D *linein, 
					FLGR_Data1D *tmpline, int size) {
  FLGR_1D_MACRO_INTERNAL_DILATE_LOG(fgINT32);
}
void flgr1d_internal_dilate_log_fgFLOAT32(FLGR_Data1D *lineout, FLGR_Data1D *linein, 
					  FLGR_Data1D *tmpline, int size) {
  FLGR_1D_MACRO_INTERNAL_DILATE_LOG(fgFLOAT32);
}
void flgr1d_internal_dilate_log_fgFLOAT64(FLGR_Data1D *lineout, FLGR_Data1D *linein, 
					  FLGR_Data1D *tmpline, int size) {
  FLGR_1D_MACRO_INTERNAL_DILATE_LOG(fgFLOAT64);
}








void flgr1d_erode_log_fgBIT(FLGR_Data1D *lineout, FLGR_Data1D *linein, int size) {
  FLGR_Data1D *linetmp = flgr1d_create_signal_from(linein);

  FLGR_DECLARE_FUNCTION;

  flgr1d_internal_erode_log_fgBIT(lineout,linein,linetmp,size);

  flgr1d_destroy(linetmp);
}
void flgr1d_erode_log_fgUINT8(FLGR_Data1D *lineout, FLGR_Data1D *linein, int size) {
  FLGR_Data1D *linetmp = flgr1d_create_signal_from(linein);

  FLGR_DECLARE_FUNCTION;

  flgr1d_internal_erode_log_fgUINT8(lineout,linein,linetmp,size);

  flgr1d_destroy(linetmp);
}
void flgr1d_erode_log_fgUINT16(FLGR_Data1D *lineout, FLGR_Data1D *linein, int size) {
  FLGR_Data1D *linetmp = flgr1d_create_signal_from(linein);

  FLGR_DECLARE_FUNCTION;

  flgr1d_internal_erode_log_fgUINT16(lineout,linein,linetmp,size);

  flgr1d_destroy(linetmp);
}
void flgr1d_erode_log_fgUINT32(FLGR_Data1D *lineout, FLGR_Data1D *linein, int size) {
  FLGR_Data1D *linetmp = flgr1d_create_signal_from(linein);

  FLGR_DECLARE_FUNCTION;

  flgr1d_internal_erode_log_fgUINT32(lineout,linein,linetmp,size);

  flgr1d_destroy(linetmp);
}
void flgr1d_erode_log_fgINT8(FLGR_Data1D *lineout, FLGR_Data1D *linein, int size) {
  FLGR_Data1D *linetmp = flgr1d_create_signal_from(linein);

  FLGR_DECLARE_FUNCTION;

  flgr1d_internal_erode_log_fgINT8(lineout,linein,linetmp,size);

  flgr1d_destroy(linetmp);
}
void flgr1d_erode_log_fgINT16(FLGR_Data1D *lineout, FLGR_Data1D *linein, int size) {
  FLGR_Data1D *linetmp = flgr1d_create_signal_from(linein);

  FLGR_DECLARE_FUNCTION;

  flgr1d_internal_erode_log_fgINT16(lineout,linein,linetmp,size);

  flgr1d_destroy(linetmp);
}
void flgr1d_erode_log_fgINT32(FLGR_Data1D *lineout, FLGR_Data1D *linein, int size) {
  FLGR_Data1D *linetmp = flgr1d_create_signal_from(linein);

  FLGR_DECLARE_FUNCTION;

  flgr1d_internal_erode_log_fgINT32(lineout,linein,linetmp,size);

  flgr1d_destroy(linetmp);
}
void flgr1d_erode_log_fgFLOAT32(FLGR_Data1D *lineout, FLGR_Data1D *linein, int size) {
  FLGR_Data1D *linetmp = flgr1d_create_signal_from(linein);

  FLGR_DECLARE_FUNCTION;

  flgr1d_internal_erode_log_fgFLOAT32(lineout,linein,linetmp,size);

  flgr1d_destroy(linetmp);
}
void flgr1d_erode_log_fgFLOAT64(FLGR_Data1D *lineout, FLGR_Data1D *linein, int size) {
  FLGR_Data1D *linetmp = flgr1d_create_signal_from(linein);

  FLGR_DECLARE_FUNCTION;

  flgr1d_internal_erode_log_fgFLOAT64(lineout,linein,linetmp,size);

  flgr1d_destroy(linetmp);
}
////////////////////////////////////////////////////////////////////////////
/*! Erode 1D signal using logarithmic decomposition
 *  
 *  R. van den Boomgaard and D.A. Wester, "Logarithmic shape decomposition,"
 *  in Aspects of Visual Form Processing, C. Arcelli, L.P. Cordella, and G. Sanniti di Baja (Eds.),
 *  World Scientific Publishing Co.: Singapore, Capri, Italy, 1994, pp. 552-561.
 *
 *  @param *lineout : pointer to the signal
 *  @param *linein : pointer to the signal
 *  @param size : structuring element segment length = 2*size+1
 *  @returns FLGR_RET_OK, ...
 */
//////////////////////////////////////////////////////////////////
FLGR_Ret flgr1d_erode_log(FLGR_Data1D *lineout, FLGR_Data1D *linein, int size) {
  FLGR_Ret ret;

  FLGR_DECLARE_FUNCTION;

  if((lineout==NULL) || (linein==NULL)) {
    POST_ERROR("Null objects!\n");
    return FLGR_RET_NULL_OBJECT;
  }

  if((ret=flgr1d_is_data_same_attributes(lineout,linein,__FUNCTION__))!=FLGR_RET_OK) return ret;

  FLGR_DISPATCH_PROCEDURE(lineout->type,flgr1d_erode_log,lineout,linein,size);

}





void flgr1d_dilate_log_fgBIT(FLGR_Data1D *lineout, FLGR_Data1D *linein, int size) {
  FLGR_Data1D *linetmp = flgr1d_create_signal_from(linein);

  FLGR_DECLARE_FUNCTION;

  flgr1d_internal_dilate_log_fgBIT(lineout,linein,linetmp,size);

  flgr1d_destroy(linetmp);
}
void flgr1d_dilate_log_fgUINT8(FLGR_Data1D *lineout, FLGR_Data1D *linein, int size) {
  FLGR_Data1D *linetmp = flgr1d_create_signal_from(linein);

  FLGR_DECLARE_FUNCTION;

  flgr1d_internal_dilate_log_fgUINT8(lineout,linein,linetmp,size);

  flgr1d_destroy(linetmp);
}
void flgr1d_dilate_log_fgUINT16(FLGR_Data1D *lineout, FLGR_Data1D *linein, int size) {
  FLGR_Data1D *linetmp = flgr1d_create_signal_from(linein);

  FLGR_DECLARE_FUNCTION;

  flgr1d_internal_dilate_log_fgUINT16(lineout,linein,linetmp,size);

  flgr1d_destroy(linetmp);
}
void flgr1d_dilate_log_fgUINT32(FLGR_Data1D *lineout, FLGR_Data1D *linein, int size) {
  FLGR_Data1D *linetmp = flgr1d_create_signal_from(linein);

  FLGR_DECLARE_FUNCTION;

  flgr1d_internal_dilate_log_fgUINT32(lineout,linein,linetmp,size);

  flgr1d_destroy(linetmp);
}
void flgr1d_dilate_log_fgINT8(FLGR_Data1D *lineout, FLGR_Data1D *linein, int size) {
  FLGR_Data1D *linetmp = flgr1d_create_signal_from(linein);

  FLGR_DECLARE_FUNCTION;

  flgr1d_internal_dilate_log_fgINT8(lineout,linein,linetmp,size);

  flgr1d_destroy(linetmp);
}
void flgr1d_dilate_log_fgINT16(FLGR_Data1D *lineout, FLGR_Data1D *linein, int size) {
  FLGR_Data1D *linetmp = flgr1d_create_signal_from(linein);

  FLGR_DECLARE_FUNCTION;

  flgr1d_internal_dilate_log_fgINT16(lineout,linein,linetmp,size);

  flgr1d_destroy(linetmp);
}
void flgr1d_dilate_log_fgINT32(FLGR_Data1D *lineout, FLGR_Data1D *linein, int size) {
  FLGR_Data1D *linetmp = flgr1d_create_signal_from(linein);

  FLGR_DECLARE_FUNCTION;

  flgr1d_internal_dilate_log_fgINT32(lineout,linein,linetmp,size);

  flgr1d_destroy(linetmp);
}
void flgr1d_dilate_log_fgFLOAT32(FLGR_Data1D *lineout, FLGR_Data1D *linein, int size) {
  FLGR_Data1D *linetmp = flgr1d_create_signal_from(linein);

  FLGR_DECLARE_FUNCTION;

  flgr1d_internal_dilate_log_fgFLOAT32(lineout,linein,linetmp,size);

  flgr1d_destroy(linetmp);
}
void flgr1d_dilate_log_fgFLOAT64(FLGR_Data1D *lineout, FLGR_Data1D *linein, int size) {
  FLGR_Data1D *linetmp = flgr1d_create_signal_from(linein);

  FLGR_DECLARE_FUNCTION;

  flgr1d_internal_dilate_log_fgFLOAT64(lineout,linein,linetmp,size);

  flgr1d_destroy(linetmp);
}
////////////////////////////////////////////////////////////////////////////
/*! Dilate 1D signal using logarithmic decomposition
 *  
 *  R. van den Boomgaard and D.A. Wester, "Logarithmic shape decomposition,"
 *  in Aspects of Visual Form Processing, C. Arcelli, L.P. Cordella, and G. Sanniti di Baja (Eds.),
 *  World Scientific Publishing Co.: Singapore, Capri, Italy, 1994, pp. 552-561.
 *
 *  @param *lineout : pointer to the signal
 *  @param *linein : pointer to the signal
 *  @param size : structuring element segment length = 2*size+1
 *  @returns FLGR_RET_OK, ...
 */
//////////////////////////////////////////////////////////////////
FLGR_Ret flgr1d_dilate_log(FLGR_Data1D *lineout, FLGR_Data1D *linein, int size) {
  FLGR_Ret ret;

  FLGR_DECLARE_FUNCTION;

  if((lineout==NULL) || (linein==NULL)) {
    POST_ERROR("Null objects!\n");
    return FLGR_RET_NULL_OBJECT;
  }

  if((ret=flgr1d_is_data_same_attributes(lineout,linein,__FUNCTION__))!=FLGR_RET_OK) return ret;

  FLGR_DISPATCH_PROCEDURE(lineout->type,flgr1d_dilate_log,lineout,linein,size);

}



/********************************************************************************************/
/********************************************************************************************/
/************************************** 2D Functions ****************************************/
/********************************************************************************************/
/********************************************************************************************/


/////////////////////////////////////////////////////////////////////////
// Macro for different types of flgr2d_erode_line_horizontal_log_fgBIT
/////////////////////////////////////////////////////////////////////////
#define FLGR_2D_MACRO_ERODE_LINE_H_LOG(dtype)				\
  FLGR_Data1D **psrc = datsrc->row;					\
  FLGR_Data1D **pdest = datdest->row;					\
  FLGR_Data1D *linetmp = flgr1d_create_signal_from(*pdest);		\
  int i;								\
									\
  FLGR_DECLARE_FUNCTION;						\
									\
  for(i=0 ; i<datdest->size_y ; i++,psrc++,pdest++)			\
    flgr1d_internal_erode_log_##dtype(*pdest,*psrc,linetmp,size);	\
  									\
  flgr1d_destroy(linetmp)

void flgr2d_erode_line_horizontal_log_fgBIT(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int size) {
  FLGR_2D_MACRO_ERODE_LINE_H_LOG(fgBIT);
}
void flgr2d_erode_line_horizontal_log_fgUINT8(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int size) {
  FLGR_2D_MACRO_ERODE_LINE_H_LOG(fgUINT8);
}
void flgr2d_erode_line_horizontal_log_fgUINT16(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int size) {
  FLGR_2D_MACRO_ERODE_LINE_H_LOG(fgUINT16);
}
void flgr2d_erode_line_horizontal_log_fgUINT32(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int size) {
  FLGR_2D_MACRO_ERODE_LINE_H_LOG(fgUINT32);
}
void flgr2d_erode_line_horizontal_log_fgINT8(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int size) {
  FLGR_2D_MACRO_ERODE_LINE_H_LOG(fgINT8);
}
void flgr2d_erode_line_horizontal_log_fgINT16(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int size) {
  FLGR_2D_MACRO_ERODE_LINE_H_LOG(fgINT16);
}
void flgr2d_erode_line_horizontal_log_fgINT32(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int size) {
  FLGR_2D_MACRO_ERODE_LINE_H_LOG(fgINT32);
}
void flgr2d_erode_line_horizontal_log_fgFLOAT32(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int size) {
  FLGR_2D_MACRO_ERODE_LINE_H_LOG(fgFLOAT32);
}
void flgr2d_erode_line_horizontal_log_fgFLOAT64(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int size) {
  FLGR_2D_MACRO_ERODE_LINE_H_LOG(fgFLOAT64);
}
////////////////////////////////////////////////////////////////////////////
/*! Erode 2D pixmap with a horizontal segment structuring element using a logarithmic decomposition
 *  
 *  R. van den Boomgaard and D.A. Wester, "Logarithmic shape decomposition,"
 *  in Aspects of Visual Form Processing, C. Arcelli, L.P. Cordella, and G. Sanniti di Baja (Eds.),
 *  World Scientific Publishing Co.: Singapore, Capri, Italy, 1994, pp. 552-561.
 *
 *  @param *datdest : pointer to the pixmap
 *  @param *datsrc : pointer to the pixmap
 *  @param size : horizontal segment structuring element segment width = 2*size+1
 *  @returns FLGR_RET_OK, ...
 */
//////////////////////////////////////////////////////////////////
FLGR_Ret flgr2d_erode_line_horizontal_log(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int size) {
  FLGR_Ret ret;
  
  FLGR_DECLARE_FUNCTION;

  if((datdest==NULL) || (datsrc==NULL)) {
    POST_ERROR("Null objects!\n");
    return FLGR_RET_NULL_OBJECT;
  }

  if((ret=flgr2d_is_data_same_attributes(datdest,datsrc,__FUNCTION__))!=FLGR_RET_OK) return ret;

  FLGR_DISPATCH_PROCEDURE(datdest->type,flgr2d_erode_line_horizontal_log,datdest,datsrc,size);

}





/////////////////////////////////////////////////////////////////////////
// Macro for different types of flgr2d_dilate_line_horizontal_log_fgBIT
/////////////////////////////////////////////////////////////////////////
#define FLGR_2D_MACRO_DILATE_LINE_H_LOG(dtype)				\
  FLGR_Data1D **psrc = datsrc->row;					\
  FLGR_Data1D **pdest = datdest->row;					\
  FLGR_Data1D *linetmp = flgr1d_create_signal_from(*pdest);		\
  int i;								\
									\
  FLGR_DECLARE_FUNCTION;						\
									\
  for(i=0 ; i<datdest->size_y ; i++,psrc++,pdest++)			\
    flgr1d_internal_dilate_log_##dtype(*pdest,*psrc,linetmp,size);	\
  									\
  flgr1d_destroy(linetmp)

void flgr2d_dilate_line_horizontal_log_fgBIT(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int size) {
  FLGR_2D_MACRO_DILATE_LINE_H_LOG(fgBIT);
}
void flgr2d_dilate_line_horizontal_log_fgUINT8(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int size) {
  FLGR_2D_MACRO_DILATE_LINE_H_LOG(fgUINT8);
}
void flgr2d_dilate_line_horizontal_log_fgUINT16(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int size) {
  FLGR_2D_MACRO_DILATE_LINE_H_LOG(fgUINT16);
}
void flgr2d_dilate_line_horizontal_log_fgUINT32(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int size) {
  FLGR_2D_MACRO_DILATE_LINE_H_LOG(fgUINT32);
}
void flgr2d_dilate_line_horizontal_log_fgINT8(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int size) {
  FLGR_2D_MACRO_DILATE_LINE_H_LOG(fgINT8);
}
void flgr2d_dilate_line_horizontal_log_fgINT16(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int size) {
  FLGR_2D_MACRO_DILATE_LINE_H_LOG(fgINT16);
}
void flgr2d_dilate_line_horizontal_log_fgINT32(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int size) {
  FLGR_2D_MACRO_DILATE_LINE_H_LOG(fgINT32);
}
void flgr2d_dilate_line_horizontal_log_fgFLOAT32(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int size) {
  FLGR_2D_MACRO_DILATE_LINE_H_LOG(fgFLOAT32);
}
void flgr2d_dilate_line_horizontal_log_fgFLOAT64(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int size) {
  FLGR_2D_MACRO_DILATE_LINE_H_LOG(fgFLOAT64);
}
////////////////////////////////////////////////////////////////////////////
/*! Dilate 2D pixmap with a horizontal segment structuring element using a logarithmic decomposition
 *  
 *  R. van den Boomgaard and D.A. Wester, "Logarithmic shape decomposition,"
 *  in Aspects of Visual Form Processing, C. Arcelli, L.P. Cordella, and G. Sanniti di Baja (Eds.),
 *  World Scientific Publishing Co.: Singapore, Capri, Italy, 1994, pp. 552-561.
 *
 *  @param *datdest : pointer to the pixmap
 *  @param *datsrc : pointer to the pixmap
 *  @param size : horizontal segment structuring element segment width = 2*size+1
 *  @returns FLGR_RET_OK, ...
 */
//////////////////////////////////////////////////////////////////
FLGR_Ret flgr2d_dilate_line_horizontal_log(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int size) {
  FLGR_Ret ret;
  
  FLGR_DECLARE_FUNCTION;

  if((datdest==NULL) || (datsrc==NULL)) {
    POST_ERROR("Null objects!\n");
    return FLGR_RET_NULL_OBJECT;
  }

  if((ret=flgr2d_is_data_same_attributes(datdest,datsrc,__FUNCTION__))!=FLGR_RET_OK) return ret;

  FLGR_DISPATCH_PROCEDURE(datdest->type,flgr2d_dilate_line_horizontal_log,datdest,datsrc,size);

}




//! @}
